// import Vue from 'vue'
const state = {
    seedActivity: {},
    seedPicbook: [],
    isSeedActivityShow: true,
    isResulteShow: false,
    isSeedEntery: false,
}
const getters = {
    //获取种子用户相关参数
    getSeedActivity(state) {
        return state.seedActivity;
    },
    getSeedPicbook(state) {
        return state.seedPicbook;
    },
    //控制邀请框显示
    getIsSeedActivityShow(state){
        return  state.isSeedActivityShow
    },
    //活动用户数据显示
    getIsResulteShow(state){
        return  state.isResulteShow
    },
    //判断是否从活动页面进入
    getIsSeedEntery(state){
        return  state.isSeedEntery
    },
};
const mutations = {
    //初始化绘本角色
    setSeedActivity(state, param) {
        state.seedActivity = param
    },
    //获取种子用户的推荐绘本
    setSeedPicbook(state, param) {
        if(state.seedPicbook.indexOf(param) < 0){
            state.seedPicbook.push(param)
        }
    },
    deleteSeedPicbook(state) {
        if (state.seedPicbook.length > 0) {
            state.seedPicbook.splice(0, state.seedPicbook.length)
        }
    },
    //控制邀请框显示
    setIsSeedActivityShow(state, param) {
        state.isSeedActivityShow = param
    },
    //活动用户数据显示
    setIsResulteShow(state,param){
       state.isResulteShow = param
    },
    //判断是否从活动页面进入
    setIsSeedEntery(state,param){
        state.isSeedEntery = param
    },
};
const actions = {
    setSeedActivity({commit}, param) {
        commit('setSeedActivity', param);
    },
    setSeedPicbook({commit}, param) {
        commit('setSeedPicbook', param);
    },
    deleteSeedPicbook({commit}) {
        commit('deleteSeedPicbook');
    },
    setIsSeedActivityShow({commit}, param) {
        commit('setIsSeedActivityShow', param);
    },
    setIsResulteShow({commit}, param) {
        commit('setIsResulteShow', param);
    },
    setIsSeedEntery({commit}, param) {
        commit('setIsSeedEntery', param);
    }
};
export default {
    namespaced: true, //用于在全局引用此文件里的方法时标识这一个的文件名
    state,
    getters,
    mutations,
    actions
}
